﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Atosenet
{
    public static class RandomGenerator
    {
        #region 成员

        private static Random _random = new Random(GetRandomSeed());

        #endregion


        #region 公开函数

        public static int Next(int minValue, int maxValue)
        {
            return _random.Next(minValue, maxValue);
        }

        #endregion


        #region 静态函数

        private static int GetRandomSeed()
        {
            byte[] bytes = new byte[4];
            System.Security.Cryptography.RNGCryptoServiceProvider rng = new System.Security.Cryptography.RNGCryptoServiceProvider();
            rng.GetBytes(bytes);
            return BitConverter.ToInt32(bytes, 0);
        } 

        #endregion
    }
}
